<?php $this->load->view("common/page_header");?>
<div id="body_main">
	<div id="admin_header">
		<?php $this->load->view('common/admin_header'); ?>
		<div class="top_cleft">
			<ul>
				<li><a href="###">栏目设置</a></li>
			</ul>
			<div class="clear"></div>
		</div>
	</div>
	<div id="admin_content">
		<div id="admin_navigator">
			<ul class="navigator">
<!--				<li><a href="###">行家库</a></li>-->
<!--				<li class="current"><a href="###">贴事板</a></li>-->
<!--				<li><a href="###">合作组</a></li>-->
			</ul>
		</div>
		<div id="admin_body">
			<form action="/console/categories/save_ordering" method="post" id="category-form">
			<table class="a_table text_left_table vertical_top_table admin_categories">
			<?php foreach($categories as $category) {?>
				<tr height="50">
					<td width="500">
						<a href="/console/categories/?category_id=<?php echo $category['id'];?>"><?php echo $category['name'];?></a>
						<a href="/console/categories/add_son?category_id=<?php echo $category['id'];?>">+添加子栏</a>
					</td>
					<td>
						<a href="/console/categories/edit?category_id=<?php echo $category['id'];?>" class="margin_right15 blue">编辑</a>
						<a href="/console/categories/delete?category_id=<?php echo $category['id'];?>" class="margin_right15 blue">删除</a>
						<input type="text" size="4" name="ordering[<?php echo $category['id']?>]" value="<?php echo $category['ordering'];?>"></input>
					</td>
				</tr>
				<?php }?>
			</table>
			<input type="hidden" name="category_id" value="<?php echo empty($category_id) ? $category_id : 0?>"></input>
			<a class="orange_button margin_left10" href="/console/categories/add_sibling?category_id=<?php echo $category['id'];?>">+添加栏目</a>
			<a class="orange_button margin_left10" href="javascript:void(0);" id="save-ordering">保存顺序</a>
			</form>
		</div>
		<div class="clear"></div>
	</div>
	<?php $this->load->view("common/footer");?>	
</div>
<script type="text/javascript">
$(document).ready(function(){
	$("#save-ordering").click(function() {
		$("#category-form").submit();
	})
});
</script>	
<?php $this->load->view("common/page_footer");?>